<?php 

 foreach($this->ogladajhd as $x ) :
$db = Zend_Db_Table::getDefaultAdapter();
$gat = $db->select()
                    ->from('genres', 'genre')
                    ->where('idgenre = ?', $this->escape($x['idgenre']));
$gatunek = $db->fetchRow($gat);


$ulub = new Application_Model_Favorites_Ulubione();
 $sprulub = $ulub->sprawdzUlubione($x['idmovie'],$this->iduser); 
        if(!$sprulub){
           echo '<form action="'. $this->url( array('controller' => 'zalogowani', 'action' => 'ogladajhd'), 'default', false) .'" method="post">';
           echo '<input type=hidden name="user" value="'.$this->iduser.'"/>';
           echo '<input type=hidden name="movie" value="'.$x['idmovie'].'"/>';
           echo $this->button;
            echo '</form>';
            }
?>

<h1><?php echo $this->escape($this->title); ?></h1>

<hr><h2>Tytul filmu:</h2>
<?php echo $this->escape($x['title']).' HD';?>
<br><hr>

<img src="<?php echo $this->baseUrl()."/miniatures/".$this->escape($x['miniature']); ?>" width="20%" height="25%"/><br>

<hr><h2>Opis filmu:</h2>
<?php echo $this->escape($x['description']);?><br>

<hr><h2>Gatunek filmu:</h2>
     <?php echo $gatunek['genre'];?><br><hr>
    
<?php endforeach; ?>
     
<div>
    <div id="myElement">Wczytywanie filmu...</div>
    <script type="text/javascript">
        jwplayer("myElement").setup({
            file: "<?php echo $this->baseUrl()."/movies/".$this->escape($x['source']);?>",
            image: "<?php echo $this->baseUrl()."/miniatures/".$this->escape($x['miniature']); ?>",
            title: "<?php echo $this->escape($x['title']);?>",
            width: 480,
            height: 320
        });
    </script>
    <!-- <h1><a href="<?php echo $this->baseUrl()."/movies/".$this->escape($x['source']);?>">Ogladaj</a></h1><br> -->
</div>
